package com.guli.vod.controller;

import com.guli.common.vo.R;
import com.guli.vod.service.VideoService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author XiaoHua666
 * @date 2019/4/29
 */
@ApiModel(value = "阿里云视频点播微服务",description = "阿里云视频点播微服务")
@RestController
@CrossOrigin
@RequestMapping("/vod/video")
public class VideoController {
    @Autowired
    private VideoService videoService;

    @GetMapping("get-play-auth/{videoId}")
    public R getVideoPlayAuth(
            @ApiParam(value = "视频id", name = "videoId", required = true)
            @PathVariable("videoId") String videoId

    ) {
        //得到播放凭证
        String playAuth = videoService.getVideoPlayAuth(videoId);

        //返回结果
        return R.ok().message("获取凭证成功").data("playAuth", playAuth);
    }
}
